package com.ceshiren.test.houduankaifa.service.impl;

import com.ceshiren.test.houduankaifa.dao.StudentMapper;
import com.ceshiren.test.houduankaifa.dto.StudentDto;
import com.ceshiren.test.houduankaifa.service.StudentService;
import com.ceshiren.test.houduankaifa.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    StudentMapper studentMapper;


    @Override
    public Result findAll() {
        List<StudentDto> allStudents = studentMapper.findAllStudents();
        if (!allStudents.isEmpty()) {
            return Result.success().data(allStudents);
        }
        return Result.error().msg("查询学生信息为空");
    }
}
